package cn.swenty.backstage.framework.controller.enums;

public enum Error {
	/**
	 * 验证失败
	 */
	VALIDATION_FAIL("10001","validation failed"),
	
	
	/**
	 * 限制访问
	 * */
	LIMIT_VISIT("10002","limit visit"),
	
	
	/**
	 * session 超时
	 */
	SESSION_TIMEOUT("10003","session timeout "),
	
	
	/**
	 * 找不到页面
	 */
	PAGE_LOSE("10004","cann't find page"),
	

	
	/**
	 * 系统异常
	 */
	DEAL_ERROR("10005","system deal error");
	
	
	
	
	private String code;
	
	private String error;
	
	private String describe;
	
	
	// 获取status
	public static Error get(String code) {
		for (Error c : Error.values()) {
			if (c.getCode().equals(code)) {
				return c;
			}
		}
		return null;
	}

	


	public String getDescribe() {
		return describe;
	}




	public void setDescribe(String describe) {
		this.describe = describe;
	}




	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}
	private Error(String code,String error){
		this.code = code;
		this.error = error;
	}
	private Error(String code,String error,String describe){
		this.code = code;
		this.error = error;
		this.describe = describe;
	}
}
